<template>
  <div class="main" v-if="visible">
    <div class="el-dialog">
    <div class="dialog_title">{{title}}
      <span @click="BtnL"></span>
    </div>
    <div class="dialog_content">{{content}}</div>
    <div class="dialog_btns">
      <span @click="BtnL">{{leftBtn}}</span>
      <span @click="BtnR">{{rightBtn}}</span>
    </div>
    </div>
    <div class="mask"></div>
  </div>
</template>

<script>
export default {
  name: 'el-dialog',
  methods: {
    hideD() {
      this.$emit('update:visible', false);
      return this;
    },
    BtnL() {
      this.hideD();
    },
    BtnR() {
      this.hideD();
    },
  },
  props: ['title', 'content', 'leftBtn', 'rightBtn', 'visible'],
};
</script>

<style lang="scss" scoped>
.el-dialog{
  width: 577px;
  height: 198px;
  border-radius: 2px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  background: #fff;
  z-index: 9999;
  .dialog_title{
    letter-spacing: 2px;
    color: #303133;
    font-size: 18px;
    line-height: 24px;
    margin: 20px 0 10px 0;
    text-align: center;
    span{
      display: inline-block;
      width: 15px;
      height: 15px;
      background-image: url(./false.png);
      position: absolute;
      right: 23px;
      top: 23px;
    }
    span:hover{
      background-image: url(./false_h.png);
      cursor: pointer;
    }
  }
  .dialog_content{
    margin: 25px 25px 30px;
    font-size: 14px;
    color: #606266;
  }
  .dialog_btns{
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    span{
       font-size: 14px;
       border-radius: 4px;
       padding: 12px 20px;
       border:1px solid #dcdfe6;
       cursor: pointer;
       text-align: center;
       color: #606266;
    }
    span:first-child{
      margin-right: 10px;
      &:hover{
        color: #409eff;
        border-color: #c6e2ff;
        background-color: #ecf5ff;
      }
    }
    span:last-child{
      margin-left: 10px;
      color: #fff;
      background-color: #409eff;
      border-color: #409eff;
      &:hover{
        background-color: #66b1ff;
        border-color: #66b1ff;
        color: #fff;
      }
    }
  }
}
  .mask{
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,.2);
  }
</style>
